import "./index.scss";
import { useNavigate, useLocation } from "react-router-dom";

const Particularstwo1 = () => {
  //时间转换
  const toDub = (n: any) => (n < 10 ? "0" + n : "" + n);
  //年月日时分秒
  const toTime = (date: any) => {
    const oTime = new Date(date);
    return (
      oTime.getFullYear() +
      "-" +
      toDub(oTime.getMonth() + 1) +
      "-" +
      toDub(oTime.getDate()) +
      " " +
      toDub(oTime.getHours()) +
      ":" +
      toDub(oTime.getMinutes()) +
      ":" +
      toDub(oTime.getSeconds())
    );
  };

  //取数据
  const state = useLocation();
  console.log("state", state.state);

  //返回
  const navigate = useNavigate();
  const back = () => {
    navigate("/zhome/z-Report");
  };

  return (
    <div className="student-detail">
      <div className="top">
        <div className="title" onClick={back}>
          举报信息
        </div>
        <div>&gt;</div>
        <div className="detail">详情</div>
      </div>

      <div className="hr"></div>
      <div className="context-box">
        <div className="context">
          <div className="tr">
            <div className="td1">举报人</div>
            <div className="td2">{state.state.rname}</div>
          </div>
          <div className="tr">
            <div className="td">联系方式</div>
            <div>{state.state.rphone}</div>
          </div>
          <div className="tr">
            <div className="td">举报对象</div>
            <div>{state.state.robject}</div>
          </div>
          <div className="tr">
            <div className="td">举报内容</div>
            <div>{state.state.rcontent}</div>
          </div>
          <div className="tr">
            <div className="td">解决时间</div>
            <div>{toTime(state.state.rreadytime)}</div>
          </div>
          <div className="tr">
            <div className="td">解决结果</div>
            <div>{state.state.rpasstext}</div>
          </div>
        </div>
      </div>
    </div>
  );
};
export default Particularstwo1;
